from pydantic import BaseModel as PyBaseModel, ConfigDict
from pydantic.alias_generators import to_camel, to_snake

class BaseModel(PyBaseModel):
  model_config = ConfigDict(populate_by_name=True, alias_generator=to_camel)

# class Config(BaseModel):
#   # 头顶位置
#   overhead_position: float = 0.11
#
# class User(BaseModel):
#   config: Config
#   base64: str         # 标准化图
#   base64_unscaled: str
#   base64_mark: str
#
# data = {
#   "base64": "1",
#   "base64Unscaled": "base64Unscaled",
#   "base64Mark": "base64Mark",
#   "config": {
#     "overheadPosition": 0.12
#   }
# }
#
# ins = User(**data)
# print(ins)
# print(ins.model_dump_json(by_alias=True))
